﻿using BootstrapBlazor.Components;
using OnWork.DataCenter.DAL.DataCenter;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OnWork.DataCenter.Shared.Pages.DataSource
{
    /// <summary>
    /// 对象
    /// </summary>
    public class MqttTopicVO
    {
        /// <summary>
        /// 主键
        /// </summary>
        [AutoGenerateColumn(Visible = false, Readonly = true)]
        public long ID { get; set; }

        /// <summary>
        /// 主题连接名称
        /// </summary>
        [Required(ErrorMessage = "{0}不能为空"), MaxLength(255)]
        [AutoGenerateColumn(Text = "配置名称", Searchable = true, Filterable = true, Sortable = true), DisplayName("配置名称")]
        public string Name { get; set; }

        /// <summary>
        /// 订阅的主题
        /// </summary>
        [Required(ErrorMessage = "{0}不能为空")]
        [AutoGenerateColumn(Text = "订阅主题", Searchable = true, Filterable = true, Sortable = true), DisplayName("订阅主题")]
        public string Topic { get; set; }

        /// <summary>
        /// 是否启用 默认不启用
        /// </summary>
        [AutoGenerateColumn(Text = "启用", Searchable = true, Filterable = true, Sortable = true), DisplayName("启用")]
        public bool Enable { get; set; } = false;

        /// <summary>
        /// MQTT配置的ID
        /// </summary>
        [AutoGenerateColumn(Text = "MQTT服务",ShowSearchWhenSelect =true), DisplayName("MQTT服务")]
        public long MqttID { get; set; }

        /// <summary>
        /// 关联MQTT配置里的对象
        /// </summary>
        public MQTTConfigVO Mqtt { get; set; } = new MQTTConfigVO();
    }
}
